<?php

/**
 * 核算类型仓库
 * @author wangwx 2015-5-15
 */
namespace common\repositories\myhtsq;
use common\repositories\BaseRepository;
use common\support\StringHelper;
use common\entities\myhtsq\InvoiceEntity;
use common\entities\myhtsq\BussAccountTypesEntity;
class BussAccountTypesRepository extends BaseRepository{

	/**
	 * 构造方法
	 * @param unknown $config (optional)
	 */
	public function __construct($config = [])
	{
		parent::__construct($config);
	}
	
	
	/**
	 * 获取所有核算类型
	 * @return array
	 */
	public static function getAllBussAccountTypes() {
		return BussAccountTypesEntity::find()->select('type_id,type_name')->all();
	}

	public static function getRevenueTypeIdByName($typename) {
		$str = BussAccountTypesEntity::find()->select('type_id')->where(['type_name'=>$typename])->scalar();
		if (empty($str)) {
			$str = '';
		}
		return $str;
	}

	public static function getRevenueTypeNameById($typeid) {
		$str = BussAccountTypesEntity::find()->select('finance_type_name')->where(['type_id'=>$typeid])->scalar();
		if (empty($str)) {
			$str = '';
		}
		return $str;
	}
}